<?php

require_once ('../scripts/php_entity_link/model/EntityDS.class.php');

/* Creation of an entity DS class for a table */
$movieDS = new php_entity_link\EntityDS("movie", "localhost");

/* Inserting a record */
$new_record = $movieDS->getNullObject();
$new_record->title = "The Guardian";
$new_record->playtime = 133;
$new_record->year = 2006;
$movieDS->save($new_record);

/* Updating a record */
$new_record->description = "test description";
$movieDS->save($new_record);

/* deleting a record */
$movieDS->delete($new_record);

/* Selecting all records form the movie table */
$records = $movieDS->select($count);
foreach($records as $record){
    echo $record."<br />";
}//next

/* Selecting film with title 'Tigerland' */
$where = "title = ".$movieDS->getSQLValueString("Good Morning Vietnam", DS::DB_TYPE_STRING);
$records = $movieDS->select($count, $where);
foreach($records as $record){
    echo $record."<br />";
}//next 


?>